// 目标：统计单词频率并返回 HashMap
// TODO: 补全 word_frequency 函数
use std::collections::HashMap;

fn word_frequency(text: &str) -> HashMap<&str, u32> {
    let mut map = HashMap::new();
    for word in text.split_whitespace() {
        // 更新词频计数
    }
    map
}

#[test]
fn test_word_freq() {
    let text = "apple banana apple orange";
    let freq = word_frequency(text);
    assert_eq!(freq["apple"], 2);
}